package com.idol;

import com.idol.factory.BeanContainer;
import com.idol.factory.BeanScanner;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;
import java.io.UnsupportedEncodingException;

/**
 * @author Supreme_Sir
 * @version 1.0
 * @className StartListener
 * @description
 * @date 2020/10/13 14:26
 **/
@WebListener
public class WebStartListener implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        String packageName = WebStartListener.class.getPackage().getName();
        try {
            BeanScanner.scanPackage(packageName);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {
        System.out.println("Tomcat 关闭了~~~");
    }
}
